const log4js = require('log4js');
log4js.configure(
    {
        appenders: {
            file: {
                type: 'file',
                filename: 'jzt.log',
                maxLogSize: 10 * 1024 * 1024, // = 10Mb
                numBackups: 5, // keep five backup files
                compress: true, // compress the backups
                encoding: 'utf-8',
                mode: 0o0640,
                flags: 'w+'
            },
            dateFile: {
                type: 'dateFile',
                filename: 'more-jzt.log',
                pattern: 'yyyy-MM-dd-hh',
                compress: true
            },
            out: {
                type: 'stdout'
            }
        },
        categories: {
            default: { appenders: ['file', 'dateFile', 'out'], level: 'info' }
        }
    }
);

// const log = log4js.getLogger("jzt");

// export function getLogger(category) {
//     return log4js.getLogger(category);
// };

module.exports.getLogger = function (category) {
    return log4js.getLogger(category);
};